#include <algorithm>
#include "ToCond.h"

using namespace kc_sf;

// ------------------------------------------------------------- //

ToCond::ToCond( const std::string &localpart, const std::string &domain )
: c_localpart( localpart ),
  c_domain( domain )
{
}

// ------------------------------------------------------------- //

Logic::Symbol * ToCond::clone() const
{
	return new ToCond( *this );
}

// ------------------------------------------------------------- //

bool ToCond::eval( const Message &msg )
{
	return std::find(
		msg.mTo.begin(),
		msg.mTo.end(),
		Address( c_localpart, c_domain ) ) != msg.mTo.end();
}
